< previous page page_13 next page >

Page 13
Table 1.3. Command Button properties for the Title form.
NameCaption
cmdAdd&Add
cmdDelete&Delete

Note.gif
Adding an ampersand (&) to the Caption of a command button causes the letter immediately following the ampersand to be underlined. The underlined letter (also known as a shortcut key or hot key) serves as a prompt to the user to indicate that it can be pressed in conjunction with the Ctrl key to execute the procedure that the button contains.

0013-01.jpg
Figure 1.8.
The form layout after adding the
Add and Delete command buttons.
Double-click the Add button to bring up the Visual Basic code window to add code behind the Add command button. You see the subroutine header and footer already entered for you. All you need to do is add a single line of Visual Basic code between them.
Private Sub cmdAdd_Click()
   datTitles.Recordset.AddNew  ' add a new record to the table
End Sub
Note.gif
Visual Basic automatically creates the Sub_End Sub routines for each new procedure you create. When you are performing the exercises in this book, insert the code only between these two lines (in other words, don't repeat the Sub_End Sub statements, or your code will not work properly).

 
< previous page page_13 next page >

If you like this book, buy it!